<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
     <%@ page import="xm.web.servelet.HelloWorld" %>
     <%@ page import="xm.web.bean.User" %>
 <%
 String path = request.getContextPath();
 String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
 %>
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 <html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 <title>Insert title here</title>
 </head>
 <body>
 <b>
 path=request.getContextPath()<br>:<%=path %><br>
 basePath=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"<br>
 :<%=basePath %>
 <br></b>
<p>如何正确的访问 servlet 路径</p>
<ul>
 <li><a href="s/hello" target="_blank"> 访问servlet (s/hello) </a></li>
 <li><a href="/s/hello" target="_blank"> 访问servlet(/s/hello)</a></li>
 <li><a href="web/s/hello" target="_blank"> 访问servlet(web/s/hello)</a></li>
 <li><a href="/web/s/hello" target="_blank"> 访问servlet(/web/s/hello)</a></li>
 <li><a href="<%=basePath %>s/hello" target="_blank"> 访问servlet (<\%basePaths%>s/hello) </a></li>
 
 </ul>

 </body>
 </html>